package testing.ms2;

import java.util.Random;

import server.command.client.ClientInputHandler;
import utils.RemoteProcedureInvokationUtil;

public class ServerTester {

	public static void main(String[] args) {
		System.out.println("Start testing:");
		//testCommandHandler();
		testSSH();
	}
	
	public static void testSSH() {
		RemoteProcedureInvokationUtil.invokeSSH("script.sh");
	}
	
	public static boolean testCommandHandler() {
		ClientInputHandler ch = new ClientInputHandler(false, null);
		String[] inputs = new String[] {
			"put###key###value",
			"get###key###",
			"put###key###v",
			"put###k",
			"put###k###c",
			"put###k###",
			"put######",
			"put######y",
			"put###b###valb",
			"put###c###valc",
			"put###a###vala",
			"list_keys######",
			"list_values######"
		};
		for (String inp: inputs) { 
			String resp = ch.processCommand(inp);
			System.out.println(resp);
		}
		return true;	
	}
	
	public static String generateString(int size) {
		String gen = "";
		Random rand = new Random(26);
		for (int i=0; i<size; i++) {
			gen += (char) (48+(rand.nextInt()%26));
		}
		return gen;
	}

}
